﻿namespace Athena.Codec.Implementations
{
    /// <summary>
    /// json格式的编码器工厂类型
    /// </summary>
    public class JsonRpcMessageCodecFactory : IRpcMessageCodecFactory
    {
        private IRpcMessageEncoder _rpcMessageEncoder;
        private IRpcMessageDecoder _rpcMessageDecoder;

        public JsonRpcMessageCodecFactory()
        {
            _rpcMessageEncoder = new JsonRpcMessageEncoder();
            _rpcMessageDecoder = new JsonRpcMessageDecoder();
        }

        /// <summary>
        /// 创建解码器
        /// </summary>
        /// <returns></returns>
        public IRpcMessageDecoder CreateDecoder()
        {
            return _rpcMessageDecoder;
        }

        /// <summary>
        /// 创建解码器
        /// </summary>
        /// <returns></returns>
        public IRpcMessageEncoder CreateEncoder()
        {
            return _rpcMessageEncoder;
        }
    }
}
